package com.mng.AOPanno;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class UserAspe {
  //
  @Pointcut(value = "execution(* com.mng.AOPanno.User.add(..))")
  public void pc(){

  }
  @Before(value = "execution(* com.mng.AOPanno.User.add(..))")
  public void before(){
    System.out.println("before");
  }
  @After(value="pc()")
  public void after(){
    System.out.println("after");
  }
  @AfterReturning(value="pc()")
  public void aftterReturing() {
    System.out.println("after returning");
  }
  @AfterThrowing(value = "pc()")
  public void afterThrowing() {
    System.out.println("after throwing");

  }
  @Around(value = "pc()")
  public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{
    System.out.println("环绕前");
    proceedingJoinPoint.proceed();
    System.out.println("环绕后");
  }

}
